//
// Created by Jisam on 2024年11月16日21:23:09.
// Solution of  B. Penchick and Satay Sticks
#include <bits/stdc++.h>

#define  int long long
#define  endl "\n"
#define  all(x) (x).begin(),(x).end()
#define  pb push_back
using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n ; i ++){
        cin >> a[i];
    }
    for(int i = 0 ;i < n ; i ++){
        if(a[i] == a[i + 1]  + 1){
            swap(a[i],a[i + 1]);
        }
    }
    cout << (is_sorted(all(a)) ? "YES" : "NO") << endl;
}
signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    cin >> _;
    while(_ --){
        solve();
    }
    return 0;
}